/**
 * Created by Administrator on 2016/7/1 0001.
 */
var district_Arr='';
$(document).ready(function(){
    district_Arr=JSON.parse(sessionStorage.getItem('district_Arr'));
    for(var i=0;i<district_Arr.length;i++){
        var Region_str='<option value="'+district_Arr[i].id+'">---'+district_Arr[i].name+'---</option>';
        var district=district_Arr[i].district;
        for(var j=0;j<district.length;j++){
            Region_str+='<option value="'+district[j].id+'">'+district[j].name+'</option>';
        }
        $('#Region'+(i+1)).html(Region_str);
    }
})



$('.mainContent select').each(function () {
    $(this).on('change',function(){
        var $select_location = $(this).find('option:selected');
        sessionStorage.setItem('rec_add',$select_location.html());
        var id = $select_location.val();
        var name = $select_location.html();
        MPJ.setDistrict(id, name);

        var arr={
            hf_s_id:"WD11",
            hf_srv_id:"Av_jcart",
            hs_set_ddc_by_dist_id:$(this).find('option:selected').val(),
            hf_locale_id:"en"
        };
        getAjaxRequest(arr,function(result){
            console.log(result);
        });
        location.replace(document.referrer);
    })
});
